#ifndef MY_RENDER_CUBE
#define MY_RENDER_CUBE
#include "./object.hpp"
#include "./triangle.hpp"

#include <vector>
using std::vector;



namespace object{

    class Cube:public Object{
        public:
        Cube(){}
        Cube(Dot position,int size){
            this->position=position;
            auto vertices=std::vector<Dot>{
                Dot(position.x+(size/2),position.y+(size/2),position.z+(size/2)),
                Dot(position.x+(size/2),position.y+(size/2),position.z-(size/2)),
                Dot(position.x+(size/2),position.y-(size/2),position.z+(size/2)),
                Dot(position.x+(size/2),position.y-(size/2),position.z-(size/2)),
                Dot(position.x-(size/2),position.y+(size/2),position.z+(size/2)),
                Dot(position.x-(size/2),position.y+(size/2),position.z-(size/2)),
                Dot(position.x-(size/2),position.y-(size/2),position.z+(size/2)),
                Dot(position.x-(size/2),position.y-(size/2),position.z-(size/2))
            };
            this->vertices=vertices;
        }
    };
    class ColorCube:public Cube,public ColorTriangleComponent{
        public:
        ColorCube(){}
        // 生成默认的绿色三角形
        ColorCube(Dot position,int size):Cube(position,size){
            // 六个面，一个面两个三角形，一共12个绿色的三角形
            colorTriangles=std::vector<ColorTriangle>{
                ColorTriangle(0,1,2,0,1,0),
                ColorTriangle(1,3,2,0,1,0),
                ColorTriangle(4,5,6,0,1,0),
                ColorTriangle(5,7,6,0,1,0),
                ColorTriangle(0,2,4,0,1,0),
                ColorTriangle(2,6,4,0,1,0),
                ColorTriangle(1,5,3,0,1,0),
                ColorTriangle(5,7,3,0,1,0),
                ColorTriangle(0,4,1,0,1,0),
                ColorTriangle(4,5,1,0,1,0),
                ColorTriangle(2,3,6,0,1,0),
                ColorTriangle(3,7,6,0,1,0)
            };
        }
        ColorCube(Dot position,int size,vector<ColorTriangle> colorTriangles):Cube(position,size),ColorTriangleComponent(colorTriangles){}
    };
}



#endif